import java.util.Arrays;
import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/5/21 14:59
 */

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int StuNum = in.nextInt();
            int[] score = new int[StuNum];
            for (int i = 0; i < StuNum; i++) {
                    int C = in.nextInt();
                    int M = in.nextInt();
                    int E = in.nextInt();
                    score[i] = C + M + E;
            }
            Arrays.sort(score);
            for (int i = StuNum - 1; i >= 0; i--) {
                System.out.println(score[i]);
            }
        }
    }
}